{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2188615969072\n",
      "2188615969072\n",
      "2188615969360\n"
     ]
    }
   ],
   "source": [
    "def var_id():\n",
    "    a = 1\n",
    "    print(id(a))\n",
    "    b = 1\n",
    "    print(id(b))\n",
    "    a = 10\n",
    "    print(id(a))\n",
    "\n",
    "var_id()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "outputs": [],
   "source": [
    "def change(num1, num2):\n",
    "    print(\"-\" * 50)\n",
    "    print(\"%d %d在函数内的内存地址是%x，%x\" % (num1, num2, id(num1), id(num2)))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2188615969360\n",
      "--------------------------------------------------\n",
      "10 10在函数内的内存地址是1fd93ad6a50，1fd93ad6a50\n"
     ]
    }
   ],
   "source": [
    "a = 10\n",
    "print(id(a))\n",
    "b = 10\n",
    "change(a, b)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}